﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
    CodeBehind="Test.aspx.cs" Inherits="EXAM.Test" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder3" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderMain" runat="server">
    <telerik:RadWindowManager ID="RadWindowManager2" runat="server" Modal="true" Skin="Vista"
        Height="500px" Width="350px" Style="z-index: 10000" VisibleStatusbar="False">
        <Windows>
            <telerik:RadWindow ID="Win_ViewReport" runat="server" Behavior="Default" OnClientClose="GetDataFromGrid_Report">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">

        <script type="text/javascript">
        
        

        function GetDataFromGrid_Report(sender,agrs)
        {
            var hdCOMMAND_TYPE = document.getElementById("<%=hdCOMMAND_TYPE.ClientID%>"); 
            hdCOMMAND_TYPE.value=agrs.get_argument().DlgRes;
            __doPostBack('<%=btnReload.UniqueID %>','');
        }
        
        function openWin_ViewLookUp()
        {
            var oWnd1 = radopen("./Windows/frmListQ.aspx", "Win_ViewReport");
            oWnd1.SetTitle("Question List");
        }
        function confirmCallBackFn(arg)
        {
            radalert("<strong>radconfirm</strong> returned the following result: <h3 style='color: #ff0000;'>" + arg + "</h3>", null, null, "Result");
        }
        function SetUniqueRadioButton(nameregex, current)
        {
           re = new RegExp(nameregex);
           for(i = 0; i < document.forms[0].elements.length; i++)
           {
              elm = document.forms[0].elements[i]
              if (elm.type == 'radio')
              {
                 if (re.test(elm.name))
                 {
                    elm.checked = false;
                 }
              }
           }
           current.checked = true;
        }
        function GetCountDont()
        {
            setTimeout(function(){GetCountDont()}, 1000);
        }
        /*-----------------------Timer---------------------------*/
        var timer = {
            minutes :0,
            seconds : 0,
            minctrl :null,
            secctrl : null,
            aminctrl:null,
            asecctrl:null,
            sep : ':',
            init : function(minctrl,secctrl)
            {
                this.aminctrl = document.getElementById('<%=hdMin.ClientID %>');
                this.asecctrl = document.getElementById('<%=hdSec.ClientID %>');
                m = parseInt(this.aminctrl.value,10);
                s = parseInt(this.asecctrl.value,10);
                if(m < 0 || s <0 || isNaN(m) || isNaN(s)) { alert('Invalid Values'); return; }
                this.minutes = m;
                this.seconds = s;
                this.minctrl = document.getElementById(minctrl);
                this.secctrl = document.getElementById(secctrl);
                timer.start();
            },
            start : function()
            {
                this.samay = setInterval((this.doCountDown),1000);
            },
            stop : function()
            {
                clearInterval(timer.samay);
            },
            doCountDown : function()
            {
                if(timer.seconds == 0)
                {
                    if(timer.minutes == 0)
                    {
                        clearInterval(timer.samay);
                        timerComplete();
                        return;
                    }
                    else
                    {
                        timer.seconds=60;
                        timer.minutes--;
                    }
                }
                timer.seconds--;
                timer.aminctrl.value=timer.minutes;
                timer.asecctrl.value=timer.seconds;
                timer.updateTimer(timer.minutes,timer.seconds);
            },
            updateTimer :  function(min,secs)
            {
                min = (min < 10 ? '0'+min : min);
                secs = (secs < 10 ? '0'+secs : secs);
                (this.minctrl).innerHTML=min;
                (this.secctrl).innerHTML=secs;
            }
        }
        
    /*------------------------Timer-----------------------*/
        </script>

    </telerik:RadCodeBlock>
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">

        <script type="text/javascript">
        function timerComplete() { 
      /*  __doPostBack("<%=btnStart.UniqueID %>"); */
        
        setTimeout("__doPostBack('<%=btnStart.UniqueID %>','')", 0);
        }</script>

    </telerik:RadScriptBlock>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Vista">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="btnPrev">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnNext">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnReload">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnHint">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnList">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbExplan" />
                    <telerik:AjaxUpdatedControl ControlID="lbLine" />
                    <telerik:AjaxUpdatedControl ControlID="lbQuest" />
                    <telerik:AjaxUpdatedControl ControlID="lbType" />
                    <telerik:AjaxUpdatedControl ControlID="btnPrev" />
                    <telerik:AjaxUpdatedControl ControlID="btnNext" />
                    <telerik:AjaxUpdatedControl ControlID="dlAnswer" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>
    <h2 class="art-postheader">
    </h2>
    <div class="cleared">
    </div>
    <div class="art-postcontent">
        <span id="mtq_quiztitle-1" class="mtq_quiztitle">
            <h2>
                <asp:Label ID="lbName" runat="server" Text="Label"></asp:Label></h2>
            <h4>
                <div id="defaultCountdown" class="hasCountdown">
                    <table style="font-size: 15px; font-weight: bold; width: 100%;">
                        <tr>
                            <td>
                                <asp:Label ID="lbMin" runat="server" Text="28" Width="30px"></asp:Label><asp:HiddenField
                                    ID="hdMin" runat="server" />
                            </td>
                            <td>
                                <asp:Label ID="lbSec" runat="server" Text="13"></asp:Label><asp:HiddenField ID="hdSec"
                                    runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                Min.
                            </td>
                            <td>
                                Sec.
                            </td>
                        </tr>
                    </table>
                </div>
                <asp:HiddenField ID="lbPassScore" runat="server" />
            </h4>
        </span><span id="mtq_instructions-1" class="mtq_instructions" style="display: block;">
            <asp:Label ID="lbDescription" runat="server" Text="Label"></asp:Label>
            <br />
        </span>
        <asp:Button ID="btnStart" runat="server" Text="Start" class="mtq_action_button mtq_css_button mtq_start_button"
            OnClick="btnStart_Click" Width="198px" />
        <span runat="server" class="mtq_quiz_results_bubble" id="mtq_quiz_results_bubble"
            style="display: block;" visible="false"><span class="mtq_quiz_results" id="mtq_quiz_results-1"
                style="display: block;">
                <p>
                    Congratulations - you have completed <em>Your test</em>.</p>
                <div style="float: right; width: 128px; height: 128px; margin-right: 40px;">
                    <asp:Image ID="imgMsg" runat="server" ImageUrl="images/noimage.png" />
                </div>
                <p>
                    You answered
                    <asp:Literal ID="lbNumOfAns" runat="server"></asp:Literal>
                    out of
                    <asp:Literal ID="lbNumofQuest" runat="server"></asp:Literal>.</p>
                <p>
                    You have
                    <asp:Literal ID="lbCorrect" runat="server"></asp:Literal>
                    correct answers, rate is
                    <%=lbCorrect.Text%>/<%=lbNumOfAns.Text%></p>
                <p>
                    You scored
                    <asp:Literal ID="lbScore" runat="server"></asp:Literal>%.</p>
                <p>
                    <asp:Literal ID="lbNotes" runat="server"></asp:Literal></p>
                <br />
            </span><span class="mtq_quiz_results_highlight" id="mtq_quiz_results_highlight-1"
                style="display: block;">
                <telerik:RadButton ID="btnHistory" runat="server" Text="Click here to preview your Test"
                    OnClick="btnHistory_Click">
                </telerik:RadButton>
                <telerik:RadButton ID="btn" runat="server" Text="Back to Test Template" OnClick="btn_Click">
                </telerik:RadButton>
            </span><span class="mtq_quiz_results" id="mtq_quiz_results-1" style="display: block;">
                <asp:HiddenField ID="hdNo" runat="server" />
            </span></span><span id="mtq_question_container" style="display: block;" runat="server">
                <div class="mtqscrollable" id="mtq_scroll_container-1" style="width: 100%;">
                    <div id="mtq_scroll_items_container-1" style="left: 0px; width: 100%">
                        <!-- root element for the items -->
                        <div class="mtq_question" id="mtq_question-1-1" style="width: 100%">
                            <span style="color: rgb(255, 102, 0);">
                                <asp:Literal ID="lbType" runat="server" Text="Question [No]"></asp:Literal></span>
                            <table class="mtq_question_heading_table">
                                <tbody>
                                    <tr>
                                        <td>
                                            <asp:Label ID="lbLine" runat="server" Text="Question [No]" class="mtq_question_label "></asp:Label>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <span id="mtq_question_text-1-1" class="mtq_question_text">
                                <asp:Literal ID="lbQuest" runat="server" Text="Question........"></asp:Literal>
                            </span>
                            <asp:ListView ID="dlAnswer" runat="server" OnItemDataBound="dlAnswer_ItemDataBound">
                                <ItemTemplate>
                                    <tr>
                                        <td class="mtq_letter_button_td">
                                            <span class="mtq_letter_button mtq_letter_button" id="mtq_button-1-1-1">
                                                <asp:Image ID="img" ImageUrl="" Visible="false" runat="server" />
                                                <asp:Literal ID="txtNum" runat="server"></asp:Literal>
                                                <asp:RadioButton ID="rbAnswer" runat="server" GroupName="Quest" Visible="false" AutoPostBack="true"
                                                    OnCheckedChanged="rbAnswer_CheckedChanged" />
                                                <asp:TextBox ID="txtAnswer" runat="server" Visible="false" AutoPostBack="true" OnTextChanged="txtAnswer_TextChanged"></asp:TextBox>
                                                <asp:CheckBox ID="ckbAnswer" runat="server" Visible="false" AutoPostBack="true" OnCheckedChanged="ckbAnswer_CheckedChanged" /></span>
                                            <span id="mtq_marker-1-1-1" class="mtq_marker mtq_wrong_marker" alt="Wrong"></span>
                                        </td>
                                        <td class="mtq_answer_td">
                                            <span class="mtq_answer_text">
                                                <%# Eval("AnsName")%></span>
                                            <asp:HiddenField ID="hdNo" runat="server" Value="" />
                                            <asp:HiddenField ID="hdLine" runat="server" Value="" />
                                            <asp:HiddenField ID="hdAnsID" runat="server" Value="" />
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <LayoutTemplate>
                                    <table class="mtq_answer_table">
                                        <colgroup>
                                            <col class="mtq_oce_first">
                                        </colgroup>
                                        <tbody>
                                            <tr id="itemPlaceholder" runat="server">
                                            </tr>
                                        </tbody>
                                    </table>
                                </LayoutTemplate>
                            </asp:ListView>
                        </div>
                    </div>
                </div>
                <br />
                <asp:Label ID="lbExplan" runat="server" class="mtq_question_label "></asp:Label>
                <br />
                <table class="mtq_listrow" style="display: block;">
                    <tbody>
                        <tr>
                            <td class="mtq_listrow_button-td">
                                <asp:Button ID="btnPrev" runat="server" Text="" class="prev browse left mtq_back_button mtq_listrow_button disabled"
                                    BorderStyle="None" BorderWidth="0px" OnClick="btnPrev_Click" />
                            </td>
                            <td>
                                <asp:Button ID="btnList" runat="server" Text="List" class="mtq_css_button" OnClick="btnList_Click"
                                    OnClientClick="openWin_ViewLookUp();return false;" />
                            </td>
                            <td class="mtq_listrow_button-td">
                                <asp:Button ID="btnNext" runat="server" Text="" class="next browse right mtq_next-button mtq_listrow_button"
                                    BorderStyle="None" BorderWidth="0px" OnClick="btnNext_Click" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </span>
        <asp:Button ID="btnReload" runat="server" Text="Button" CssClass="buttonHidden" OnClick="btnReload_Click" />
        <asp:HiddenField ID="hdCOMMAND_TYPE" runat="server" />
        <telerik:RadTextBox ID="txtTestID" runat="server" Visible="false">
        </telerik:RadTextBox>
        <telerik:RadTextBox ID="txtNo" runat="server" Visible="false">
        </telerik:RadTextBox>
    </div>
</asp:Content>
